#pragma once

#include <QObject>
#include <QString>
#include <QUrlQuery>
#include <QNetworkAccessManager>
#include <QNetworkReply>

namespace qtc_alarm_rest {

class AlarmHistoryClient : public QObject {
  Q_OBJECT
public:
  struct Config {
    QString service_uri {"http://localhost:9000"};
  };

  explicit AlarmHistoryClient(const Config& cfg, QObject* parent = nullptr);

  void search(const QUrlQuery& params);

signals:
  void resultReceived(const QByteArray&);
  void error(const QString&);

private:
  Config m_cfg;
  QNetworkAccessManager m_net;
};

} // namespace qtc_alarm_rest